//*********************************************************************
// Copyright (C) 2014 Hell Prototypes / www.hellprototypes.com
// 
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
//********************************************************************
#include <avr/io.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include <stdio.h>
#include "common.h"

extern const UI_listmenu_t main_menu;

void hw_init(void)
{
	PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;

	millis_init();//Init first
	uart_init();
	i2c_init();
	spi_init();
	buzzer_init();
	battery_init();
	key_init();
	oled_init();

	memory_init();
}

int main(void)
{
	hw_init();

	printf("\r\nHell Watch\r\n");

	//buzzer_buzz(200);

	ui_listmenu(&main_menu);

	sys_power_off();
	while(1);
}


